﻿<!doctype html>
<%@page contentType="text/html;charset=UTF-8"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
<html lang="en">
<f:view>
	<f:loadBundle var="messages" basename="messages"></f:loadBundle>
<head>
	<title><h:outputText value="#{messages['system_title']}" /></title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link href="../../css/default.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="../../js/jquery-1.4.2.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath()%>/js/My97DatePicker/WdatePicker.js"></script>
	
	<script type="text/javascript">
	</script>
</head>
<body class="main" style="overflow-x:hidden;">
<a id="viewDiv"></a>
		<h:form id="edituserform">
			<h:inputHidden value="#{userAction.userBean.id}"></h:inputHidden>
			<h:panelGrid columns="3">
				
				
				<h:outputText value="#{messages['login_page_label_username']}" />
				<h:inputText id="userName" value="#{userAction.userBean.userName}" > </h:inputText>
				<h:message for="userName" style="color:red" />
				
				<h:outputText value="#{messages['login_page_label_password']}" />
				<h:inputSecret id="password" value="#{userAction.userBean.password}" >
					<f:validateLength minimum="6" maximum="20" />
				</h:inputSecret>
				<h:message for="password" style="color:red" />
				
				<h:outputText value="#{messages['user_page_label_user_type']}"></h:outputText>
				<h:selectOneRadio id="usertypeVal" value="#{userAction.userBean.userType}" >
					<f:selectItem itemValue="1" itemLabel="#{messages['user_page_label_user_type_student']}"  />
					<f:selectItem itemValue="2" itemLabel="#{messages['user_page_label_user_type_teacher']}"  />
					<f:selectItem itemValue="3" itemLabel="#{messages['user_page_label_user_type_employee']}"  />
				</h:selectOneRadio>
				<h:message for="usertypeVal" style="color:red" />
				
				<h:outputText value="#{messages['user_page_label_dormitory_address']}" />
				<h:inputText id="dormitoryAddress" value="#{userAction.userBean.dormitoryAddress}" > </h:inputText>
				<h:message for="dormitoryAddress" style="color:red" />
				
				<h:outputText  value="#{messages['user_page_label_email']}" />
				<h:inputText id="email" value="#{userAction.userBean.email}" > </h:inputText>
				<h:message for="email" style="color:red" />
				
				<h:outputText  value="#{messages['user_page_label_sex']}" />
				<h:selectOneRadio id="sex" value="#{userAction.userBean.sex}"   >
					<f:selectItem itemValue="1" itemLabel="#{messages['user_page_label_sex_man']}"  />
					<f:selectItem itemValue="0" itemLabel="#{messages['user_page_label_sex_woman']}"  />
				</h:selectOneRadio>
				<h:message for="sex" style="color:red" />
				
				<h:outputText  value="#{messages['user_page_label_mobile']}" />
				<h:inputText id="mobile" value="#{userAction.userBean.mobile}" > </h:inputText>
				<h:message for="mobile" style="color:red" />
				
				<h:outputText  value="#{messages['user_page_label_home_address']}" />
				<h:inputText id="homeAddress" value="#{userAction.userBean.homeAddress}" > </h:inputText>
				<h:message for="homeAddress" style="color:red" />
				
				<h:outputText  value="#{messages['user_page_label_birthdate']}" />
				<h:inputText id="birtdate" value="#{userAction.userBean.birtdate}" styleClass="input"
							onfocus=" new WdatePicker({startDate:'%Y-%M-%D',dateFmt:'yyyy-MM-dd',alwaysUseStartDate:true})"  ></h:inputText>
				<h:message for="birtdate" style="color:red" />
				
				<h:outputText  value="#{messages['user_page_label_zip_code']}" />
				<h:inputText id="zipCode" value="#{userAction.userBean.zipCode}" > </h:inputText>
				<h:message for="zipCode" style="color:red" />
				
				<h:outputText  value="#{messages['user_page_label_admission_time']}" />
				<h:inputText id="admissionTime" value="#{userAction.userBean.admissionTime}" styleClass="input"  
							onfocus=" new WdatePicker({startDate:'%Y-%M-%D',dateFmt:'yyyy-MM-dd',alwaysUseStartDate:true})"></h:inputText>
				<h:message for="admissionTime" style="color:red" />
				
				<h:outputText  value="#{messages['faculty_page_label_faculty_name']}" />
				<h:selectOneMenu id="faculty" value="#{userAction.userBean.facultyId}" valueChangeListener="#{userAction.facultyChange}"  immediate="true"  >
					<f:selectItem itemLabel="#{messages['messages_select']}" itemValue="-1" />
					<f:selectItems value="#{userAction.facultySelectItem}" />
					<a4j:support event="onchange" reRender="specialty" ajaxSingle="true"></a4j:support>
				</h:selectOneMenu>
				<h:message for="faculty" style="color:red" />
				
				<h:outputText  value="#{messages['specialty_page_label_name']}" />
				<a4j:outputPanel>
					<h:selectManyCheckbox id="specialty" value="#{userAction.specialtyList}" layout="pageDirection" styleClass="many">
						<f:selectItems value="#{userAction.specialtySelectItem}" />
					</h:selectManyCheckbox>
				</a4j:outputPanel>
				<h:message for="specialty" style="color:red" />
				
				<h:outputText  value="#{messages['user_page_label_enrollment']}" />
				<h:inputText id="enrollment" value="#{userAction.userBean.enrollment}" > </h:inputText>
				<h:message for="enrollment" style="color:red" />
				
				<h:outputText  value="#{messages['user_page_label_image']}" />
				<h:inputText id="image" value="#{userAction.userBean.image}" > </h:inputText>
				<h:message for="image" style="color:red" />
				
				<h:outputText  value="#{messages['user_page_label_grade']}" />
				<h:inputText id="grade" value="#{userAction.userBean.grade}" > </h:inputText>
				<h:message for="grade" style="color:red" />
				
				<f:facet name="footer">
					<h:panelGroup>
						<h:commandButton value="#{messages['btn_submit']}" action="#{userAction.edit}" />
						<h:outputText value=" "></h:outputText>
						<h:commandButton value="#{messages['btn_reset']}" type="reset" />
					</h:panelGroup>
				</f:facet>
			</h:panelGrid>
		</h:form>
</body>
	</f:view>
	<script type="text/javascript">
		$(document).ready(function() {
			//document.getElementById('viewDiv').scrollIntoView();
		});
	</script>
</html>